﻿using System;
using SharpSqlAnalyzer.nodes;
using SharpSqlAnalyzer.nodes.mssql;

namespace SharpSqlAnalyzer.stmt.mssql
{
	// Token: 0x0200017F RID: 383
	public class TMssqlRaiserror : TCustomSqlStatement
	{
		// Token: 0x06000D61 RID: 3425 RVA: 0x003089DE File Offset: 0x00306BDE
		public TMssqlRaiserror(EDbVendor dbvendor) : base(dbvendor)
		{
			this.sqlstatementtype = ESqlStatementType.sstraiserror;
		}

		// Token: 0x06000D62 RID: 3426 RVA: 0x003089F2 File Offset: 0x00306BF2
		internal override void buildsql()
		{
		}

		// Token: 0x06000D63 RID: 3427 RVA: 0x003089F4 File Offset: 0x00306BF4
		internal override void clear()
		{
		}

		// Token: 0x06000D64 RID: 3428 RVA: 0x003089F6 File Offset: 0x00306BF6
		internal override string getasprettytext()
		{
			return "";
		}

		// Token: 0x06000D65 RID: 3429 RVA: 0x003089FD File Offset: 0x00306BFD
		internal virtual void iterate(TVisitorAbs pvisitor)
		{
		}

		// Token: 0x17000271 RID: 625
		// (get) Token: 0x06000D66 RID: 3430 RVA: 0x003089FF File Offset: 0x00306BFF
		// (set) Token: 0x06000D67 RID: 3431 RVA: 0x00308A1A File Offset: 0x00306C1A
		public virtual TExpressionList Args
		{
			get
			{
				if (this.args == null)
				{
					this.args = new TExpressionList();
				}
				return this.args;
			}
			set
			{
				this.args = value;
			}
		}

		// Token: 0x17000272 RID: 626
		// (get) Token: 0x06000D68 RID: 3432 RVA: 0x00308A23 File Offset: 0x00306C23
		// (set) Token: 0x06000D69 RID: 3433 RVA: 0x00308A2B File Offset: 0x00306C2B
		public virtual TExpression MessageText
		{
			get
			{
				return this.messageText;
			}
			set
			{
				this.messageText = value;
			}
		}

		// Token: 0x17000273 RID: 627
		// (get) Token: 0x06000D6A RID: 3434 RVA: 0x00308A34 File Offset: 0x00306C34
		// (set) Token: 0x06000D6B RID: 3435 RVA: 0x00308A3C File Offset: 0x00306C3C
		public virtual TExpression Severity
		{
			get
			{
				return this.severity;
			}
			set
			{
				this.severity = value;
			}
		}

		// Token: 0x17000274 RID: 628
		// (get) Token: 0x06000D6C RID: 3436 RVA: 0x00308A45 File Offset: 0x00306C45
		// (set) Token: 0x06000D6D RID: 3437 RVA: 0x00308A4D File Offset: 0x00306C4D
		public virtual TExpression State
		{
			get
			{
				return this.state;
			}
			set
			{
				this.state = value;
			}
		}

		// Token: 0x06000D6E RID: 3438 RVA: 0x00308A58 File Offset: 0x00306C58
		public override int doParseStatement(TCustomSqlStatement psql)
		{
			if (this.rootNode == null)
			{
				return -1;
			}
			TMssqlRaiserrorSqlNode tmssqlRaiserrorSqlNode = (TMssqlRaiserrorSqlNode)this.rootNode;
			base.doParseStatement(psql);
			if (tmssqlRaiserrorSqlNode.Msgs != null)
			{
				this.messageText = tmssqlRaiserrorSqlNode.Msgs.getExpression(0);
				if (tmssqlRaiserrorSqlNode.Msgs.size() > 2)
				{
					this.severity = tmssqlRaiserrorSqlNode.Msgs.getExpression(1);
					this.state = tmssqlRaiserrorSqlNode.Msgs.getExpression(2);
				}
				if (tmssqlRaiserrorSqlNode.Msgs.size() > 3)
				{
					for (int i = 3; i < tmssqlRaiserrorSqlNode.Msgs.size(); i++)
					{
						this.Args.addExpression(tmssqlRaiserrorSqlNode.Msgs.getExpression(i));
					}
				}
			}
			return 0;
		}

		// Token: 0x06000D6F RID: 3439 RVA: 0x00308B0B File Offset: 0x00306D0B
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x06000D70 RID: 3440 RVA: 0x00308B1B File Offset: 0x00306D1B
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x04001309 RID: 4873
		private TExpression messageText;

		// Token: 0x0400130A RID: 4874
		private TExpression severity;

		// Token: 0x0400130B RID: 4875
		private TExpression state;

		// Token: 0x0400130C RID: 4876
		private TExpressionList args;
	}
}
